package io.gitee.mojingjiao.day02;

import org.junit.Test;

import java.lang.reflect.Array;
import java.util.Arrays;
import java.util.Scanner;

public class ShuZu {
//    数组练习
//    数组是否已经排序


    public static boolean isSorted(int[] numbers){
        int min=numbers[0];
        for(int i=1;i<numbers.length;i++){
            if (min>numbers[i])
                return false;
            min=numbers[i];
        }
        return true;
    }

//    public static void main(String[] args) {
//        Scanner sc=new Scanner(System.in);
//        int len=sc.nextInt();
//        int[] array=new int[len];
//        for (int i = 0; i < array.length; i++) {
//            array[i]=sc.nextInt();
//        }
//        System.out.println(isSorted(array));

//}


// 数组倒置

public static void reverse(int[] array){
        for(int i=0 ;i<=array.length/2;i++){
            int temp=array[i];
            array[i]=array[array.length-1-i];
            array[array.length-1-i]=temp;

        }
        System.out.println(Arrays.toString(array));
}

    public static void main(String[] args) {
        Scanner arr=new Scanner(System.in);
        int len=arr.nextInt();
        int[]array=new int[len];
        for(int i=0;i<array.length;i++){
            array[i]=arr.nextInt();
        }
       reverse(array);
    }

    //二维数组练习
    @Test
public  void  newArray() {
        int[][] scores = {
                {11, 12, 13, 14},
                {21, 22, 23, 24},
                {31, 32, 33, 34}
        };
        for (int i = 0; i <= 2; i++) {
            for (int j = 0; j <= 3; j++) {
                System.out.print(scores[i][j] + "    ");
            }
            System.out.println();
        }

    }



@Test
        public  void thirdArray(){
            int[][] num= {
                    {11, 12, 13, 14},
                    {21, 22, 23, 24},
                    {31, 32, 33, 34}
            };

    for (int i = 2; i >= 0; i--) {
        for (int j = 0; j <= 3; j++) {
            System.out.print(num[i][j] + "    ");
        }
        System.out.println();
    }

}

@Test

public  void secArray(){
    int[][] nums= {
            {11, 12, 13, 14},
            {21, 22, 23, 24},
            {31, 32, 33, 34}
    };

    for (int i = 2; i >= 0; i--) {
        for (int j = 3; j >=0; j--) {
            System.out.print(nums[i][j] + "    ");
        }
        System.out.println();
    }

}


//数组顺时针转90°打印

@Test
public void test3() {
    int[][] score = {
            {11, 12, 13, 14},
            {21, 22, 23, 24},
            {31, 32, 33, 34}
    };

    for (int j = 0; j <=3; j++) {
        for (int i = 2; i >= 0; i--) {
            System.out.print(score[i][j] + " ");
        }
        System.out.println();
    }


}





        }





















